package com.ethanzzh.ethanzzh_xdclass.service;

import com.ethanzzh.ethanzzh_xdclass.mapper.VideoMapper;
import com.ethanzzh.ethanzzh_xdclass.model.pojo.Video;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.persistence.Id;
import java.util.List;

@Service
public class VideoService {

    @Autowired
    private VideoMapper videoMapper;

    public List<Video> findAll(){
        return videoMapper.findVideos();
    }

    public Video findById(Integer id) {
        return videoMapper.selectByPrimaryKey(id);
    }

    public int update(Video video) {
        return videoMapper.update(video);
    }

    public int delete(Integer id) {

        return videoMapper.deleteByPrimaryKey(id);
    }

    public int save(Video video) {
        return videoMapper.insertSelective(video);
    }
}
